package main //必须

import "fmt"

func main() {
	var result int
	result = Add(4, 5)
	fmt.Println(" result = ", result)

	var funcType FuncType = Add
	result = Calc(45, 78, funcType)
	fmt.Println(" add-result = ", result)

	funcType = Minus
	result = Calc(45, 78, funcType)
	fmt.Println(" Minus-result = ", result)

	funcType = Mul
	result = Calc(45, 78, funcType)
	fmt.Println(" Mul-result = ", result)

}

func Add(a, b int) int {
	return a + b
}

func Minus(a, b int) int {
	return a - b
}

func Mul(a, b int) int {
	return a * b
}

type FuncType func(int, int) int

func Calc(a, b int, funcType FuncType) (result int) {
	fmt.Printf("=====Calc==== a = %d , b = %d  \n ", a, b)
	result = funcType(a, b)
	return
}
